package com.keyboardr.gamerater;

import java.util.Comparator;

public class NameComparator<T extends Player> implements Comparator<T>{
	private boolean down;
	public NameComparator(boolean b) {
		down = b;
	}

	@Override
	public int compare(T paramT1, T paramT2) {
		int tbr = paramT1.firstName.compareTo(paramT2.firstName);
		if(tbr == 0){
			tbr = paramT1.lastName.compareTo(paramT2.lastName);
		}
		if(down){
			tbr *= -1;
		}
		return tbr;
	}		
}
